/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.uca.sisbec.decorators;

import org.displaytag.decorator.ColumnDecorator;

/**
 *
 * @author Susy
 */
public class MateriaDecorator implements ColumnDecorator {
     public String decorate(Object o) {
        StringBuffer buffer = new StringBuffer(1000);
        return decorateColumn(buffer,(String)o);
    }

    private String decorateColumn(StringBuffer buffer, String obj) {
        String[] campos = obj.split("\\|");
        String link = "";
        if (campos[2].equals("A")){
            link = "<a href=\"\" onclick=\"deshabilitar('" + obj + "')\"";
            link += ">Deshabilitar</a>";
        } else {
            link = "<a href=\"#\" onclick=\"deshabilitar('" + obj + "')\"";
            link += ">Habilitar</a>";
        }
        buffer.append(link);
        return buffer.toString();
    }
}
